Safe locking for multi-threaded Java with exceptions

نویسندگان

  • Einar Broch Johnsen
  • Thi Mai Thuong Tran
  • Olaf Owe
  • Martin Steffen
چکیده

There are many mechanisms for concurrency control in high-level programming languages. In Java, the original mechanism for concurrency control, based on synchronized blocks, is lexically scoped. For more flexible control, Java 5 introduced non-lexical lock primitives on re-entrant locks. These operators may lead to runtime errors and unwanted behavior; e.g., taking a lock without releasing it, which could lead to a deadlock, or trying to release a lock without owning it. This paper develops a static type and effect system to prevent the mentioned lock errors for a formal, object-oriented calculus which supports non-lexical lock handling and exceptions. Based on an operational semantics, we prove soundness of the effect type analysis. Challenges in the design of the effect type system are dynamic creation of threads, objects, and especially of locks, aliasing of lock references, passing of lock references between threads, and reentrant locks as found in Java. Furthermore, the exception handling mechanism complicates the control-flow and thus the analysis.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Strategized Locking, Thread-safe Interface, and Scoped Locking Patterns and Idioms for Simplifying Multi-threaded C++ Components

Developing multi-threaded applications is hard since incorrect use of locks can cause subtle and pernicious errors. Likewise, developing multi-threaded reusable components is hard since it can be time-consuming to customize components to support new, more efficient locking strategies. This paper describes a pair of patterns, Strategized Locking and Thread-safe Interface, and a C++ idiom, Scoped...

متن کامل

Extending JML for Modular Specification and Verification of Multi-threaded Programs

The Java Modeling Language (JML) is a formal specification language for Java that allows developers to specify rich software contracts for interfaces and classes, using preand postconditions and invariants. Although JML has been widely studied and has robust tool support based on a variety of automated verification technologies, it shares a problem with many similar object-oriented specificatio...

متن کامل

Automatic Approach Towards Actor-Oriented Programming

The new era of multi-core processing challenges software designers to efficiently exploit the parallelism that is now massively available. Programmers have to exchange the conventional sequential programming paradigm for parallel programming: single-threaded designs must be decomposed into dependent, interacting tasks. The Java programming language has built-in thread support and is therefore s...

متن کامل

Special Issue on Java Technologies for Real-Time and Embedded Systems JTRES2013

The first paper [2] discusses software locking mechanisms that commonly protect shared resources for multi-threaded applications. This mechanism can, especially in chip-multiprocessor systems, result in a large synchronization overhead. For real-time systems in particular, this overhead increases the worstcase execution time and may void a task set's schedulability. This paper presents two hard...

متن کامل

ScopeJ: A Multi-threaded Region Calculus

We introduce ScopeJ, a statically typed, multi-threaded, object calculus in which scopes are first class constructs which reify the notion of allocation context and provide a safe alternative to automatic memory management by ensuring linear time allocation and bulk deallocation. The design of ScopeJ has been driven by the requirement of the Real-time Specification for Java and backwards compat...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • J. Log. Algebr. Program.

دوره 81  شماره 

صفحات  -

تاریخ انتشار 2012